﻿using System;

namespace YPBox
{
    public static class RandomHelper
    {
        /// <summary>
        /// 获得一个int型随机数，区间为[minValue, maxValue)
        /// </summary>
        /// <param name="minValue">最小值</param>
        /// <param name="maxValue">最大值</param>
        /// <returns></returns>
        public static int RInt(int minValue, int maxValue)
        {
            Guid guid = Guid.NewGuid();
            return new Random(guid.GetHashCode()).Next(minValue, maxValue);
        }

        /// <summary>
        /// 获得一个float型随机数，区间为[minValue, maxValue)
        /// </summary>
        /// <param name="minValue">最小值</param>
        /// <param name="maxValue">最大值</param>
        /// <returns></returns>
        public static float RFloat(float minValue, float maxValue)
        {
            Guid guid = Guid.NewGuid();
            return (float)(new Random(guid.GetHashCode()).NextDouble() * (maxValue - minValue) + minValue);
        }
    }
}
